﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.Reporting.WebForms;
using System.Configuration;
using FONCREAGROINTEGRAL.Models;
//using System.Configuration.ConfigurationSettings;

namespace FONCREAGROINTEGRAL.Views.semoviente
{
    public partial class form1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            SistIntFoncreagroEntities entidades = new SistIntFoncreagroEntities();
            if (!IsPostBack)
            {
                var reportServer = ConfigurationManager.AppSettings["ReportServer"].ToString();
                //var reportPath = ConfigurationManager.AppSettings["ReportPath"].ToString();

                //rptViewer.ServerReport.ReportServerUrl = new Uri(@"http://localhost:2522");
                //rptViewer.ShowToolBar = true;
                //rptViewer.ServerReport.ReportPath = reportPath + Request.QueryString["ReportName"];
                //List<ReportParameter> parameters = new List<ReportParameter>();
                //string[] keys = Request.QueryString.AllKeys;
                //for (int i = 1; i < Request.QueryString.Count; i++)
                //{
                //    parameters.Add(new ReportParameter(keys[i], Request.QueryString[i]));
                //}
                //this.rptViewer.ServerReport.SetParameters(parameters);
                //this.rptViewer.ProcessingMode = ProcessingMode.Remote;
                //this.rptViewer.ShowParameterPrompts = false;
                //this.rptViewer.ShowPromptAreaButton = false;
                //this.rptViewer.ServerReport.Refresh();

                //rptViewer.ProcessingMode = ProcessingMode.Remote;
                //rptViewer.ServerReport.Refresh();

                rptViewer.ProcessingMode = ProcessingMode.Remote;
                rptViewer.ServerReport.ReportServerUrl = new Uri(reportServer);
                rptViewer.ServerReport.ReportPath = "/RRHH/Personal";
                //rptViewer.ShowPrintButton = true;
                //ReportParameter[] param = new ReportParameter[1];
                //param[0] = new ReportParameter("CustomerID", txtparam.Text);
                //rptvw.ServerReport.SetParameters(param);

                rptViewer.ServerReport.Refresh();
                

                // Set the processing mode for the ReportViewer to Local
                        // Set the processing mode for the ReportViewer to Local
                //LocalReport localReport = new LocalReport();
                //rptViewer.ProcessingMode = ProcessingMode.Local;

                //rptViewer.LocalReport.ReportPath = Server.MapPath("~/Content/Reportes/MRBOLETAPLANILLA.rdlc");
                //ReportDataSource reportDataSource = new ReportDataSource("MRBOLETAPLANILLA", entidades.RBOLETAPLANILLA(3, 3).ToList());

                //rptViewer.LocalReport.DataSources.Add(reportDataSource);

            }
        }
    }
}